package com.sino.operation.controller;

import com.sino.operation.commons.response.CenterResponseEntity;
import com.sino.operation.dto.Dto;
import com.sino.operation.dto.inner.CenterDto;
import com.sino.operation.dto.inner.TaskStatusDto;
import com.sino.operation.dto.inner.TransTypeDto;
import com.sino.operation.service.SysCenterService;
import com.sino.operation.param.inner.TaskQueueParam;
import com.sino.operation.service.SysDictService;
import com.sino.operation.service.business.TaskQueueService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Title: BuiltInSystemController
 * @Description: 系统内部公共部分请求接口
 * @Author dengls
 * @date 2021/10/9 11:34
 */
@Slf4j
@RestController
@RequestMapping("public")
@Api(value = "",tags = "内部系统查询等操作")
public class BuiltInSystemController {

    @Autowired
    private SysDictService sysDictService;
    @Autowired
    private TaskQueueService taskQueueService;

    @Autowired
    private SysCenterService sysCenterService;

    @GetMapping("queryAllTask")
    @ApiOperation(value = "系统内部公共查询所有任务接口")
    public void queryTaskList() {
    }

    @GetMapping("findTransType")
    @ApiOperation(value = "业务类型查询接口")
    public CenterResponseEntity findTransType(){
        List<TransTypeDto> transType = sysDictService.findTransType();
        CenterResponseEntity<List> entity = CenterResponseEntity.build(List.class).setData(transType);
        return entity;
    }

    @GetMapping("findCenter")
    @ApiOperation(value = "作业中心查询接口")
    public CenterResponseEntity findCenter(){
        List<CenterDto> centerDtos = sysCenterService.findCenter();
        CenterResponseEntity<List> entity = CenterResponseEntity.build(List.class).setData(centerDtos);
        return entity;
    }

    @GetMapping("findTaskStatus")
    @ApiOperation(value = "任务状态查询接口")
    public CenterResponseEntity findTaskStatus(){
        List<TaskStatusDto> taskStatus = sysDictService.findTaskStatus();
        CenterResponseEntity<List> entity = CenterResponseEntity.build(List.class).setData(taskStatus);
        return entity;
    }

    @GetMapping("findTaskQueue")
    @ApiOperation(value = "任务队列查询接口")
    public CenterResponseEntity findTaskQueue(TaskQueueParam taskQueueParam) {
        Dto dto = taskQueueService.getTaskQueueList(taskQueueParam);
        CenterResponseEntity<Dto> data = CenterResponseEntity.build(Dto.class).setData(dto);
        return data;
    }
}
